package com.huirui.server.pojo.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 新客专区商品VO（用于接口返回商品列表/详情数据）
 */
@Data
// 类级注解：描述VO的用途，hidden=false表示在文档中显示（默认true，需显式设为false）
@Schema(description = "新客专区商品展示VO", hidden = false)
public class NewcomerAreaProductVo {

    /**
     * 商品ID（唯一标识）
     */
    @Schema(
            description = "商品唯一ID",
            example = "10001", // 示例值，便于调试
            type = "integer", // 数据类型（与Long对应）
            format = "int64" // 数据格式（Long对应int64）
    )
    private Long productId;

    /**
     * 商品名称
     */
    @Schema(
            description = "商品名称",
            example = "新客专属限量礼盒",
            maxLength = 255 // 字段最大长度限制
    )
    private String productName;

    /**
     * 商品主图URL
     */
    @Schema(
            description = "商品主图访问URL",
            example = "https://example.com/images/newcomer-product-1.jpg",
            format = "uri" // 标记为URL格式，文档中可直接点击访问
    )
    private String productImageUrl;

    /**
     * 商品原价（最低）
     */
    @Schema(
            description = "商品原价区间-最低值",
            example = "99.00",
            type = "number",
            format = "decimal", // 对应BigDecimal
            minimum = "0.01" // 最小值限制（避免负数）
    )
    private BigDecimal minPrice;

    /**
     * 商品原价（最高）
     */
    @Schema(
            description = "商品原价区间-最高值（单规格商品与minPrice一致）",
            example = "199.00",
            type = "number",
            format = "decimal",
            minimum = "0.01"
    )
    private BigDecimal maxPrice;

    /**
     * 新客促销价（最低）
     */
    @Schema(
            description = "新客专属促销价区间-最低值",
            example = "69.00",
            type = "number",
            format = "decimal",
            minimum = "0.01"
    )
    private BigDecimal minPromotionPrice;

    /**
     * 新客促销价（最高）
     */
    @Schema(
            description = "新客专属促销价区间-最高值（单规格商品与minPromotionPrice一致）",
            example = "129.00",
            type = "number",
            format = "decimal",
            minimum = "0.01"
    )
    private BigDecimal maxPromotionPrice;

    /**
     * 商品总库存
     */
    @Schema(
            description = "商品总库存数量（包含未解锁库存）",
            example = "500",
            type = "integer",
            format = "int64",
            minimum = "0" // 库存不能为负
    )
    private Long stock;

    /**
     * 可用库存（新客可购买数量）
     */
    @Schema(
            description = "新客可购买的可用库存数量",
            example = "300",
            type = "integer",
            format = "int64",
            minimum = "0"
    )
    private Long availableStock;

    /**
     * 商品创建时间（加入新客专区时间）
     */
    @Schema(
            description = "商品加入新客专区的创建时间",
            example = "2025-11-01 10:00:00",
            type = "string",
            format = "date-time" // 标记为日期时间格式，文档中会自动识别
    )
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @Schema(description = "商品原价")
    private BigDecimal price;

    @Schema(description = "商品优惠价")
    private BigDecimal promotionPrice;

    @Schema(description = "折扣")
    private BigDecimal discountRate;
}
